import request from '/@/utils/request';

export function useRoleApi() {
	return {
		getAdminRole: (params?: object) => {
			return request({
				url: '/common/role_list',
				method: 'get',
				params,
			});
		},
		postRoleDelete: (params?: object) => {
			return request({
				url: '/common/role_delete',
				method: 'post',
				data: params,
			});
		},
        getPermissions: (params?: object) => {
            return request({
                url: '/common/permissions',
                method: 'get',
                params,
            });
        },
        postRoleAdd: (data: object,permis:object) => {   
            var params = {
                data: data,
                permis: permis
            };
            return request({
                url: '/common/role_add',
                method: 'post',
                params,
            });
        },
        postRoleUpdate: (data: object,permis:object) => {
            var params = {
                data: data,
                permis: permis   
            };
            return request({
                url: '/common/role_update',
                method: 'post',
                params,
            });
        },  
        getRoleOptions: (params?: object) => {
            return request({
                url: '/common/role_options',
                method: 'post',
                params,
            });
        }
	};
}
